import pandas as pd
rd = pd.read_excel(r"超市营业额2.xlsx")  # 与代码在同一目录
print("第一题：{0}".format(rd.values[5:10]))
print("第二题：{0}".format(rd.values[5:6]))
print("第三题：{0}\t{1}\t\t{2}".format(rd.iloc[3, 0], rd.iloc[5, 1], rd.iloc[10, 4]))
data = rd.loc[[3, 5, 10], ['工号', '姓名', '交易额']].values
print("第四题：{0}".format(data))
print("第五题:{0}".format(rd.iloc[3, 0]))
data = rd.loc[3, '工号']
print("第六题：{0}".format(data))
seven = []
for i, trade in enumerate(rd['交易额']):
    if trade > 1700:
        seven.append(rd.iloc[i].values)
print("第七题：{0}".format(seven))
eight = []
for i, date in enumerate(rd['时段']):
    if date == '14：00-21：00':
        eight.append(rd.iloc[i].values)
print("第八题:{0}".format(eight))
nine = []
for i, date in enumerate(rd['时段']):
    if date == '14：00-21：00' and str(rd['交易额'][i]) != "nan":
        nine.append(rd['交易额'][i])
print("第九题：{0}".format(nine))
tenSum = 0.0
for i, date in enumerate(rd['时段']):
    if date == '14：00-21：00' and str(rd['交易额'][i]) != "nan":
        tenSum += rd['交易额'][i]
print("第十题：：{0}".format(tenSum))
elevenSum = 0.0
for i, name in enumerate(rd['姓名']):
    if name in ['张三', '李四'] and str(rd['交易额'][i]) != "nan":
        elevenSum += rd['交易额'][i]
print("第十一题：：{0}".format(elevenSum))
twelve = []
for i, trade in enumerate(rd['交易额']):
    if trade <= 850 and trade >= 800:
        twelve.append(rd.iloc[i].values)
print("第十二题：{0}".format(twelve))
